package away3d.core.data ;



class RenderableListItemPool
{
    
    
    private var _pool       : Vector<RenderableListItem> ;
    private var _index      : Int  ;
    private var _poolSize   : Int  ;
    
    
    
    public function RenderableListItemPool()
    {
        
        _pool = new Vector<RenderableListItem>() ;
        
    }
    
    
    private function get_Item() : RenderableListItem
    {
        
        if( _index == _poolSize ) 
        {
            
            var item : RenderableListItem   = new RenderableListItem() ;
            _pool[ _index++ ]               = item ;
            ++_poolSize ;
            return item ;
        
        }
        
        return _pool[ _index++ ] ;
        
    }
    
    
    public function freeAll()
    {
        
        _index = 0 ;
        
    }
    
    
    public function dispose()
    {
        
        _pool.length = 0 ;
        
    }
    
    
}
